#include <iostream>
#include <vector>

using namespace std;

// 1652. 拆炸弹
// https://leetcode.cn/problems/defuse-the-bomb/description/

class Solution
{
public:
    vector<int> decrypt(vector<int> &code, int k)
    {
        int n = code.size();
        vector<int> ans(n);
        if (k == 0)
        {
            return ans;
        }

        int temp = k;
        k = abs(k);

        int left = 0;
        int begin = 0;
        int sum = 0;
        while (left < n)
        {
            sum += code[begin % n];
            if ((begin++) - left + 1 < k)
            {
                continue;
            }
            if (temp > 0)
            {
                ans[(left + n - 1) % n] = sum;
            }else{
                ans[(left + k) % n] = sum;
            }

            sum -= code[left];
            left++;
        }

        return ans;
    }
};

int main()
{
    return 0;
}